package com.linhngua.code.gwt.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.GWT.UncaughtExceptionHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.linhngua.code.gwt.client.ui.ItemEdit;

public class ItemChangePage implements EntryPoint {

	private boolean alreadyPrompt;

	private ItemEdit itemChange ;
	@Override
	public void onModuleLoad() {
		RootPanel rootPanel = RootPanel.get("itemChange");
	    itemChange = new ItemEdit();
		itemChange.addStyleName("itemChange");
		int top = 50;
		int left = (int) (Window.getClientWidth() * 0.15);

		rootPanel.add(itemChange,left, top );

		// handle error

		GWT.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {

			public void onUncaughtException(Throwable t) {
				if (!alreadyPrompt) {
					StringBuilder builder = new StringBuilder();
					for (StackTraceElement e : t.getStackTrace()) {
						builder.append(e.toString());
					}

					Window.prompt("Error", builder.toString());
					alreadyPrompt = true;
				}

			}

		});
	}

}
